// pages/mine/jifenGift.js

const jifenService = require('../../mine/jifen/jifenGiftService.js');

Page({

  /**
   * 页面的初始数据
   */
  data: {
    cdKey: '',
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
  },

  input: function(e){
    this.setData({
      cdKey: e.detail.value
    })
  },

  duihuanClick: function(e){
    console.log(this.data.cdKey);
    jifenService.duihuan(this.data.cdKey,function(res){
      wx.showToast({
        title: '兑换成功',
      })      
    }, function (error){
      wx.showToast({
        title: error.data.message,
      })
    });
  },
  cleanInput: function (e) {
    var setMessage = { sendInfo: this.data.cdKey }
    this.setData(setMessage)
  },
})